package com.mebs.edi.model.edi.e211;

import java.sql.Time;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Embeddable;

import com.mebs.edi.model.dom.DomAttribute;
import com.mebs.edi.model.dom.DomEntity;

/**
 * 
 * G62 section (representing Date) of a 211 EDI file 
 * 
 * @author nit
 *
 */
@Embeddable
@DomEntity(name = "G62", discriminatorAttribute = "G6201", discriminatorValues = {"02", "10"})
public class Edi211G62 {
	
	@Column(nullable = true, length = 2)
	@DomAttribute
	private String g6201; 		// Date Qualifier
	
	@Column(nullable = true)
	@DomAttribute
	private Date g6202; 		// Date
	
	@Column(nullable = true, length = 2)
	@DomAttribute
	private String g6203; 		// Time Qualifier
	
	@Column(nullable = true)
	@DomAttribute
	private Time g6204; 		// Time
	
	@Column(nullable = true, length = 2)
	@DomAttribute
	private String g6205; 		// Time Code
	
	public Edi211G62() {
		super();
	}
	
	public String getG6201() {
		return g6201;
	}

	public void setG6201(String g6201) {
		this.g6201 = g6201;
	}

	public Date getG6202() {
		return g6202;
	}

	public void setG6202(Date g6202) {
		this.g6202 = g6202;
	}

	public String getG6203() {
		return g6203;
	}

	public void setG6203(String g6203) {
		this.g6203 = g6203;
	}

	public Time getG6204() {
		return g6204;
	}

	public void setG6204(Time g6204) {
		this.g6204 = g6204;
	}

	public String getG6205() {
		return g6205;
	}

	public void setG6205(String g6205) {
		this.g6205 = g6205;
	}

	@Override
	public String toString() {
		return "Edi214G62 [g6201=" + g6201 + ", g6202=" + g6202 + ", g6203=" + g6203 + ", g6204=" + g6204
				+ ", g6205=" + g6205 + "]";
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((g6201 == null) ? 0 : g6201.hashCode());
		result = prime * result + ((g6202 == null) ? 0 : g6202.hashCode());
		result = prime * result + ((g6203 == null) ? 0 : g6203.hashCode());
		result = prime * result + ((g6204 == null) ? 0 : g6204.hashCode());
		result = prime * result + ((g6205 == null) ? 0 : g6205.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Edi211G62 other = (Edi211G62) obj;
		if (g6201 == null) {
			if (other.g6201 != null)
				return false;
		} else if (!g6201.equals(other.g6201))
			return false;
		if (g6202 == null) {
			if (other.g6202 != null)
				return false;
		} else if (!g6202.equals(other.g6202))
			return false;
		if (g6203 == null) {
			if (other.g6203 != null)
				return false;
		} else if (!g6203.equals(other.g6203))
			return false;
		if (g6204 == null) {
			if (other.g6204 != null)
				return false;
		} else if (!g6204.equals(other.g6204))
			return false;
		if (g6205 == null) {
			if (other.g6205 != null)
				return false;
		} else if (!g6205.equals(other.g6205))
			return false;
		return true;
	}
}
